<template>
  <div>
    <app-layout app-brand="农业大数据信用服务平台"></app-layout>
    <warning-reminder :visible.sync="visible"></warning-reminder>
  </div>
</template>
<script>
import AppLayout from '@/credit/components/Layout'
// import { MANAGE_JOBS } from '@/credit/plugins/constant'
import { mapGetters } from 'vuex'
import WarningReminder from '@/credit/components/warningTips/WarningReminder'
import xss from 'xss'
export default {
  components: {
    AppLayout,
    WarningReminder,
  },
  props: {},
  data() {
    return {
      visible: false,
    }
  },
  computed: {
    ...mapGetters(['clientId', 'job', 'userId', 'user']),
    isUnion() {
      return this.user?.scopeArr?.includes('dirGuaPro') ?? false
    },
  },
  watch: {},
  created() {},
  mounted() {
    this.getNotice()
  },
  methods: {
    async getNotice() {
      this.$api
        .getData(
          'credit',
          'notice_placard',
          {
            'orWhere.service_id.eq': ['credit', 'all'],
          },
          { create_time: 'desc' }
        )
        .then(res => {
          const data = res.data ?? []
          data.forEach((item, index) => {
            this.$notify({
              title: `${item.notice_placard_title}`,
              dangerouslyUseHTMLString: true,
              message: xss(item.content),
              duration: 0,
              type: 'warning',
              offset: 160 * index,
            })
          })
        })
    },
    showDetail() {
      this.visible = true
    },
  },
}
</script>
<style scoped></style>
